from quote.base.operationbrowser import OperationBrowser
from quote.base.userbrowser import UseBrowser


class CustomerPage:
    def __init__(self):

        self.ob=OperationBrowser(UseBrowser.driver)


    def customer_add(self,customerNO="",customerName="",phone="",
                     address="",relationman="",otherInfo=""):
        self.ob.change_frame("Links")
        self.ob.click_name("xpath",'//*[@id="Bar_panel0_b0"]/img')
        self.ob.change_frame("main")
        self.ob.click_name("xpath",'/html/body/center/table[2]/tbody/tr[2]/td[2]/a')
        self.ob.change_windows("新增客户信息")
        self.ob.input_text_name("name","customerNO",customerNO)
        self.ob.input_text_name("name", "customerName", customerName)
        self.ob.input_text_name("name", "phone", phone)
        self.ob.input_text_name("name", "address", address)
        self.ob.input_text_name("name", "relationman", relationman)
        self.ob.input_text_name("name", "otherInfo", otherInfo)
        self.ob.click_name("name","saveButton")
    def huoqu(self):
        return self.ob.get_text_xpath('//*[@id="info"]')
    def qiehuan(self):
        self.ob.change_windows("Apache Tomcat/8.0.35 - Error report")

# if __name__=="__main__":
#     cp=CustomerPage()
#     cp.customer_add()